<template>
  <div class="face-entrance-detail">
    <descriptions :columns="columns" :data-source="dataSource" :col-span="24" />
  </div>
</template>

<script>
import { getEnumText } from '@gis/lib/enums/index.js';
import { getDoorGateDetails } from '@gis/lib/api';

export default {
  name: 'face-entrance-detail',
  components: {},
  props: {
    detail: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      dataSource: {},
      columns: [
        // { label: '所属小区', field: 'yard_name' },
        { label: '道闸名称', field: 'gate_name' },
        { label: '道闸序列号', field: 'gate_identification' },
        { label: 'ai能力层设备对照编号', field: 'ai_no' },
        { label: '设备厂商', field: 'manufacturer', format: (v) => getEnumText('ManufacturersEnum')[v] },
        {
          label: '进出方向',
          field: 'access_type',
          format: (v) => getEnumText('access_type', v),
        },
        { label: '状态', field: 'status', format: (v) => ({ 1: '正常', 2: '无效' }[v]) },
        { label: '创建人姓名', field: 'creator_name' },
        { label: '创建时间', field: 'create_time' },
        { label: '数据更新时间', field: 'modify_time' },
        { label: '备注', field: 'remark' },
      ],
    };
  },
  created() {
    this.getDevDetails();
  },
  methods: {
    async getDevDetails() {
      const data = this.handleCommonResult(
        await getDoorGateDetails({ gate_id: this.detail.id || this.detail.gate_id })
      );
      this.dataSource = data || {};
    },
  },
};
</script>

<style scoped lang="less">
.face-entrance-detail {
}
</style>
